package com.itbaizhan.controller;

import com.itbaizhan.service.UserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author spf
 * @date 2024/4/16
 * @time 10:05
 */
@RestController
@RequestMapping("/bank1")
public class TransferController {

    @Autowired
    private UserAccountService accountService;

    @GetMapping("/transfer")
    public String transfer(@RequestParam("accountNo1") String accountNo1, @RequestParam("accountNo2") String accounNo2, @RequestParam("amount") BigDecimal amount) {
        accountService.transfer(accountNo1, accounNo2, amount);
        return "转账成功！";
    }
}
